package com.cfm.bombercool 
{
	
	import org.flixel.*;
	/**
	 * ...
	 * @author devninja
	 */
	public class Explosion extends FlxSprite
	{
		
		private var playState:PlayState;
		private var power:int;
		
		public function Explosion(playState:PlayState, power:int) 
		{
			this.playState = playState;
			this.power = power;
			loadGraphic(playState.GfxPNG, true, true, 32, 32, true);
			
			addAnimation("boom", [0, 1, 2, 3, 4], 6, false);
			addAnimationCallback(onAnimation);
			
			play("boom");
			
			offset.x = 8;
			offset.y = 8;
		}
		
		override public function update():void {
			super.update();
		}
		
		protected function onAnimation(name:String, frame:uint , frameIndex:uint) {
			if ( name == "boom" && frameIndex == 4 ) {
				playState.remove(this);
			}
		}
	}

}